<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改订单信息')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-baseOrder-edit" th:object="${baseOrder}">
            <input name="id" th:field="*{id}" type="hidden" id="id">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">订单编号：</label>
                <div class="col-sm-8">
                    <input name="orderId" th:field="*{orderId}" class="form-control" type="text" required readonly>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label ">运单号：</label>
                <div class="col-sm-8">
                    <input name="transOrderId" th:field="*{transOrderId}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">所属客户：</label>
                <div class="col-sm-8">
                    <input name="referCustomerId" th:field="*{referCustomerId}" id="referCustomerId" class="form-control hidden" type="text">
                    <input name="referCustomerName" th:field="*{referCustomerName}" id="referCustomerName" class="form-control" type="text" readonly onclick="checkCustomer()">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">订单类型：</label>
                <div class="col-sm-8">
                    <select name="orderType" class="form-control m-b" th:with="type=${@dict.getType('order_type')}" readonly required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{orderType}" readonly></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">寄件人名称：</label>
                <div class="col-sm-8">
                    <input name="fCustName" th:field="*{fCustName}" class="form-control" type="text"  required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">寄件人联系方式：</label>
                <div class="col-sm-8">
                    <input name="fCustTele" th:field="*{fCustTele}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">发货地址：</label>
                <div class="col-sm-8">
                    <input name="fCustAddr" th:field="*{fCustAddr}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">收货人名称：</label>
                <div class="col-sm-8">
                    <input name="sCustName" th:field="*{sCustName}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">收货人联系方式：</label>
                <div class="col-sm-8">
                    <input name="sCustTele" th:field="*{sCustTele}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">收货地址：</label>
                <div class="col-sm-8">
                    <input name="sCustAddr" th:field="*{sCustAddr}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">物流商名称：</label>
                <div class="col-sm-8">
                    <input name="transId" th:field="*{transId}" class="form-control hidden" type="text" required >
                    <input name="transName" th:field="*{transName}" class="form-control" type="text" required readonly onclick="checkTransUnit()">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">单价：</label>
                <div class="col-sm-8">
                    <input name="unitPrice" th:field="*{unitPrice}" class="form-control" type="text" readonly required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">物品重量：</label>
                <div class="col-sm-8">
                    <input name="goodsWeight" th:field="*{goodsWeight}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group" id="startTime">
                <label class="col-sm-3 control-label">预约起始时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="subscribeStartTime"  class="form-control" placeholder="yyyy-MM-dd hh:mm:ss" type="text">
                    </div>
                </div>
            </div>
            <div class="form-group" id="endTime">
                <label class="col-sm-3 control-label">预约结束时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="subscribeEndTime"  class="form-control" placeholder="yyyy-MM-dd  hh:mm:ss" type="text">
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">金额：</label>
                <div class="col-sm-8">
                    <input name="totalPrice" th:field="*{totalPrice}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">网点名称：</label>
                <div class="col-sm-8">
                    <input name="networkId" th:field="*{networkId}" class="form-control hidden" type="text">
                    <input name="networkName" th:field="*{networkName}" class="form-control" type="text" readonly onclick="checkNetWork()">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
        var prefix = ctx + "bus/baseOrder";
        $("#form-baseOrder-edit").validate({
            focusCleanup: true,
            goodsWeight:{
                digits:true,
                min:1
            }

        });

        function submitHandler() {
            var id=$("#id").val();

            var  url=prefix + "/submit";

            if ($.validate.form()) {
                $.operate.save(url, $('#form-baseOrder-edit').serialize());
            }
        }

        $("input[name='subscribeStartTime']").datetimepicker({
            format: "yyyy-mm-dd hh:mm:ss",
            minView: "day",
            autoclose: true
        });

        $("input[name='subscribeEndTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        //选择客户代码页面
        function checkCustomer() {
            $.modal.open("选择客户信息", "/pageUtil/chooseCust");
        }
        //选中客户代码
        function checkedCustomer(customer) {
            $('#referCustomerId').val(customer.customerId);
            $('#referCustomerName').val(customer.customerName);
        }

        //选择物流商代码页面
        function checkTransUnit() {
            $.modal.open("选择物流商信息", "/pageUtil/chooseTransUnit");
        }
        //选中物流商代码
        function checkedTransUnit(transUnit) {
            $('#transId').val(transUnit.transId);
            $('#transName').val(transUnit.transName);
            $("#unitPrice").val(transUnit.unitPrice);
        }
        //选择网点页面
        function checkNetWork() {
            $.modal.open("选择物流商信息", "/pageUtil/chooseNetwork");
        }
        //选中网点代码
        function checkedNetwork(network) {
            $('#networkId').val(network.networkId);
            $('#networkName').val(network.networkName);
        }
    </script>
</body>
</html>